import { Column, Entity, JoinColumn, ManyToOne, PrimaryGeneratedColumn } from 'typeorm';
import { BaseEntity } from './base.entity';
import Company from './company.entity';
import Position from './position.entity';

/**
 * 岗位
 */
@Entity('job')
export default class Job extends BaseEntity {
  @PrimaryGeneratedColumn()
  id: number;

  @ManyToOne(() => Company, (company) => company.jobs)
  @JoinColumn({ name: 'company_id' })
  company: Company;

  @ManyToOne(() => Position, (position) => position.jobs)
  @JoinColumn({ name: 'position_id' })
  position: Position;

  @Column({ comment: '薪资' })
  salary: string;

  @Column({ comment: '经验要求' })
  experience: string;

  @Column({ comment: '学历要求' })
  education: string;

  @Column({ type: 'text', comment: '岗位职责' })
  duty: string;

  @Column({ type: 'text', comment: '岗位要求' })
  require: string;

  @Column({ name: 'enable_status', default: 1, comment: '启用状态' })
  enableStatus: number;
}
